package com.baidu.controller;

import com.baidu.entity.OrderOrShopping;
import com.baidu.service.OrderOrShoppingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpSession;

/**
 * @描述
 * @Author OrderOrShoppingController
 * @Date 2019/4/25 15:25
 **/
@Controller
@RequestMapping("/orderShopping")
public class OrderOrShoppingController {
    @Autowired
    private OrderOrShoppingService orderOrShoppingService;


    /**
     * 查询订单和商品信息
     * @param order_number
     * @return
     */
    @RequestMapping("/selectOrderShopping")
    @ResponseBody
    private OrderOrShopping selectOrderOrShoppingById(HttpSession session,Integer order_number){
        OrderOrShopping orderOrShopping = orderOrShoppingService.selectOrderOrShoppingById(order_number);
        session.setAttribute("orderOrShopping",orderOrShopping);
        System.out.println(orderOrShopping);
        if(orderOrShopping!=null){
            return orderOrShopping;
        }else{
            return null;
        }

    }
}
